<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: wu
  Date: 2018/4/16
  Time: 20:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"  pageEncoding="UTF-8" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap.min.css">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="${pageContext.request.contextPath}/static/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="${pageContext.request.contextPath}/static/bootstrap.min.js"></script>

</head>
<body>
<nav class="navbar navbar-inverse">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" title="logoTitle" href="#">简易新闻</a>
        </div>
        <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-right">
                <li role="presentation">
                    <c:if test="${user.name!= null}">
                        <a href="#">当前用户：<span class="badge">${user.name}</span></a>
                    </c:if>
                    <c:if test="${user.name== null}">
                        <a href="/view/login.jsp">登陆</a>
                        <a href="/view/register.jsp">注册</a>
                    </c:if>
                </li>
            </ul>
        </div>
    </div>
</nav>
<div style="width: 80%;margin:  0 auto;">
    <div style="padding: 10px">
        <img src="/user/image/${vo.image}">
    </div>
    <h3>${vo.title}</h3>
    <div  style="padding: 10px">
        <h4>内容: </h4>
        <p>
            ${vo.content}
        </p>
    </div>

    <hr>
    <h3>评论列表</h3>
    <c:forEach items="${vo.commentList}" var="coment">
        <p>
            <span>【${coment.createTime}】</span>:<span> ${coment.content}</span></p>
    </c:forEach>
    <c:if test="${vo.commentList.size() == 0}">
        暂无数据
    </c:if>
    <hr>

    <c:if test="${user != null}">
    <form class="form-horizontal" style="width:80%;" action="/comment/news/addComment" method="post">
        <div class="form-group">
            <div class="col-sm-10">
                <%--<input type="text" style="height: 300px" name="content" value="${comment.content}" class="form-control" id="inputEmail4" >--%>
                <textarea style="height: 150px" name="content"  class="form-control" id="inputEmail4" required ></textarea>
                    <input hidden name="parentId" value="${vo.newsId}">
            </div>
        </div>


        <div class="form-group">
            <div class="col-sm-10">
                <button type="submit" class="btn btn-default" style="width: 100px">评论</button>
                <button type="reset" class="btn btn-default" style="width: 100px">取消</button>
            </div>
        </div>
    </form>
    </c:if>
</div>
</body>
</html>
